home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 February / Macworld (1999-02).dmg / Games World / Hot Demos! / DroidWorks demo / dwCD.gob / mission_cog_b0_env_battery.cog < prev    next >
Text File  |  1998-09-17  |  2KB  |  91 lines

  1. # DroidWorks
  2. #     b0_env_battery.cog
  3. #     
  4. #    Randomizer cog for the Gear level.  
  5. #
  6. #
  7. #
  8. # Script handles random enviroment object for the maze. 
  9. # taken from env_pulley
  10. #
  11. #  
  12. # [01/16/98] DGS    Created 
  13. # [01/26/98] DGS    Added code to make it random
  14. # [01/30/98] DGS    Took from env_gear.cog and added extra things
  15. # [02/04/98] DGS    Took from b0_enf_pulley.
  16. # [03/30/98] DGS     Took from Maze_rand and converted it to Gears. 
  17.  
  18.  
  19. symbols
  20.  
  21. sector         Shuffle_s
  22. thing        thing1
  23. thing        thing2
  24. thing        thing3
  25.     
  26. message        startup
  27. message     pulse
  28. message     entered
  29.  
  30. int            amount=3        local
  31. int            inv_number=0
  32. flex        set=0.0
  33. int            enter=0            local
  34.  
  35. end
  36.  
  37. # ========================================================================================
  38.  
  39. code
  40. startup:
  41.     setpulse(0.2);
  42.     return;
  43.  
  44. pulse:
  45.         set = (rand()*amount);
  46.         //printflex(set);
  47.         return;
  48.  
  49. entered:
  50.         if (enter == 0)
  51.             {
  52.             print("Mode:");
  53.             printint(thing1);
  54.             printint(thing2);
  55.             printint(thing3);
  56.             enter = 1;
  57.             setpulse(0);
  58.             call destroy;
  59.             }
  60.         return;
  61.     
  62. destroy:
  63.     if (set < 1)
  64.         {
  65.         act_thing = thing1;
  66.         if (thing2 != 0) destroything(thing2);
  67.         if (thing3 != 0) destroything(thing3);
  68.         }
  69.     else if ( set < 2)
  70.         {
  71.         if (thing1 != 0) destroything(thing1);
  72.         act_thing = thing2;
  73.         if (thing3 != 0) destroything(thing3);
  74.         }
  75.     else if ( set < 3)
  76.         {
  77.         if (thing1 != 0) destroything(thing1);
  78.         if (thing2 != 0) destroything(thing2);
  79.         act_thing = thing3;
  80.         }
  81.     
  82.     return;
  83. taken:
  84.     SetInvAvailable(getlocalplayerthing(), inv_number, 1);
  85.     ChangeInv(getlocalplayerthing(), inv_number, 1);
  86.     destroything(act_thing);
  87.     return;
  88.  
  89. end
  90.  
  91.